package com.sushi.dao;


import com.sushi.pojo.Person;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Repository/*("personDao")*/
public interface PersonDao {

    @Select("SELECT * FROM person")
    List<Person> findAll();

    @Select("SELECT * FROM person WHERE id = #{id}")
    Person findById(int id);

    @Select("SELECT * FROM person WHERE name = #{name}")
    List<Person> findByName(String name);

//    void update(Person person);

    @Delete("DELETE FROM person WHERE id = #{id}")
    void deleteById(int id);

//    void insert(Person person);

    @Update("UPDATE person SET age = #{num} WHERE name = #{name}")
    void outAge(@Param("name") String name, @Param("num") int num);
    @Update("UPDATE person SET age = #{num} WHERE name = #{name}")
    void inAge(@Param("name") String name, @Param("num") int num);
}
